package com.vcc.web.core.queue.batch.freeze.model;

import lombok.*;

import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;

@Data
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class FreezeQueueDto implements Delayed {

    private Long cardNumberId;

    private Long taskLogId;

    private Long taskInfoId;

    private String requestId;

    private Long time;


    @Override
    public long getDelay(@NotNull TimeUnit unit) {
        return unit.convert(time - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
    }

    @Override
    public int compareTo(@NotNull Delayed o) {
        return Long.compare(getDelay(TimeUnit.MILLISECONDS), o.getDelay(TimeUnit.MILLISECONDS));
    }
}
